package live.job;

import live.common.Format;
import live.common.Log4jXmlConfig;
import live.cz.dao.ProductQuery;
import live.cz.response.XmlFormart;

import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;


public class MobileProductJob implements Job {
	private Logger log = Log4jXmlConfig.getInstance().returnLogger(MobileProductJob.class);
	private Format format = Format.getInstance();
	@Override
	public void execute(JobExecutionContext arg0) throws JobExecutionException {
		// TODO Auto-generated method stub
		try
	    {
	      String xmlStr = new ProductQuery().returnResponse();
	      if(format.isNotNullOrEmpty(xmlStr)){
	    	  XmlFormart.writeProductInfo(xmlStr);
	      }
	    }
	    catch (Exception e) {
	      log.info("手机产品任务时出现异常：" + e.getMessage());
	      e.printStackTrace();
	    }
	}
}
